<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <style>
        *{
            padding:0;
            margin:0;
        }
        input[type="text"]{
            width: 300px;
            height: 40px;
            font:16px/40px "simsun";
            color:#666;
        }
        input[type="submit"]{
            width: 80px;
            height: 44px;
            margin-left:10px;
            font:16px/44px "simsun";
            color:#000;
        }
    </style>
</head>
<body>
<form id="oForm" action="http://www.baidu.com">
    <input type="text" name="inp"><input type="submit" name="sub">
</form>
<script>
    var oForm=document.getElementById("oForm");
    oForm.onsubmit=function(){
        if(!oForm.inp.value){
            alert("请输入内容");
            return false;
        }
    }
</script>
</body>
</html>